'use strict';
/**
 * Created by FreezeSoul on 2015/9/30.
 */
define([
        'angular',
        'app/modules/schema/define',
        'app/modules/schema/services/schema-tree',
        'app/modules/schema/directives/unique-code'
    ],
    function(angular) {
        angular.module('ad.schema')
            .controller('adSchemaAddController',['$scope','$uibModalInstance','adSchemaTreeService','item',function($scope,$uibModalInstance,service,item) {
                $scope.item = {
                    schema_id:-1,
                    schema_name :'',
                    schema_code :'',
                    schema_folder_id: item.data.folder_id
                };

                $scope.ok = function () {
                    service.addSchema($scope.item).then(function(data){
                        $uibModalInstance.close(data);
                    });
                };

                $scope.cancel = function () {
                    $uibModalInstance.dismiss('cancel');
                };
            }]);
    });